package api.flashlight;

import android.content.Context;

import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.List;

import api.bean.API_TX_NativeBean;

/**
 * Created by cyly on 16/5/24.
 */
public abstract class API_TX {

    public static String clazz = "api.flashlight.Gdt_flashlight";

    private static SoftReference<API_TX> sf;

    public static boolean sFlagOn = true;

    public synchronized static API_TX getInstance() {

        if (sf == null || sf.get() == null) {
            Object o = null;
            try {
                o = Class.forName(clazz).newInstance();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            }
            if (o != null) {
                sf = new SoftReference<API_TX>((API_TX)o);
                return (API_TX)o;
            }
        }
        return sf == null ? null : sf.get();
    }

    public abstract ArrayList<API_TX_NativeBean> getnativeGDTDataRefapplyList();
    public abstract ArrayList<API_TX_NativeBean> getnativeCleanRefapplyList();
    public abstract void loadCleanApply(Context mContext,int applyNativeCount, final LoadCallBack mCallback);
    public abstract void loadGiftApply(Context mContext, int applyNativeCount, final LoadCallBack mCallback);
    public abstract void loadExitSplash(Context mContext, int applyNativeCount, final LoadCallBack callBack);

    public interface NativeCallBack{
        
        void onGDTLoaded(List var1);

        void onNoGDT(int var1);

        void onGDTStatusChanged(Object var1);

        void onGDTError(Object var1, int var2);
    }

    public interface LoadCallBack {
        void onGDTLoadSuccessed();
        void onGDTLoadedList(List arg1);
        void onGDTLoadFailed();
    }
}
